---
title: Spec - howl.ui.markup.howl
tags: spec
---
<div class="spec-group spec-group-1">

<h1 id="howl.ui.markup.howl">howl.ui.markup.howl</h1>

<h4 id="returns-a-styledtext-instance-with-empty-styles-if-no-markup-is-present">returns a StyledText instance with empty styles if no markup is present</h4>

<pre class="highlight moonscript"><code><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="nc">StyledText</span><span class="p">(</span><span class="s1">'foo'</span><span class="p">,</span><span class="w"> </span><span class="p">{}),</span><span class="w"> </span><span class="n">m</span><span class="w"> </span><span class="s1">'foo'</span></code></pre>


<h4 id="returns-a-styledtext-instance-with-styles-for-howl_markup">returns a StyledText instance with styles for howl_markup</h4>

<pre class="highlight moonscript"><code><span class="n">expected</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">StyledText</span><span class="w"> </span><span class="s1">'foo'</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="s1">'number'</span><span class="p">,</span><span class="w"> </span><span class="mi">4</span><span class="w"> </span><span class="p">}</span><span class="w">
</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="n">expected</span><span class="p">,</span><span class="w"> </span><span class="n">m</span><span class="w"> </span><span class="s1">'&lt;number&gt;foo&lt;/number&gt;'</span></code></pre>


<h4 id="allows-the-end-tag-to-be-simplified">allows the end tag to be simplified</h4>

<pre class="highlight moonscript"><code><span class="n">expected</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">StyledText</span><span class="w"> </span><span class="s1">'foobar'</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="s1">'number'</span><span class="p">,</span><span class="w"> </span><span class="mi">4</span><span class="w"> </span><span class="p">}</span><span class="w">
</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="n">expected</span><span class="p">,</span><span class="w"> </span><span class="n">m</span><span class="w"> </span><span class="s1">'&lt;number&gt;foo&lt;/&gt;bar'</span></code></pre>


<h4 id="handles-multiple-howl_markups">handles multiple howl_markups</h4>

<pre class="highlight moonscript"><code><span class="n">expected</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">StyledText</span><span class="w"> </span><span class="s1">'hi my prompt!'</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="w">
  </span><span class="mi">4</span><span class="p">,</span><span class="w"> </span><span class="s1">'string'</span><span class="p">,</span><span class="w"> </span><span class="mi">6</span><span class="p">,</span><span class="w">
  </span><span class="mi">7</span><span class="p">,</span><span class="w"> </span><span class="s1">'error'</span><span class="p">,</span><span class="w"> </span><span class="mi">13</span><span class="p">,</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="n">expected</span><span class="p">,</span><span class="w"> </span><span class="n">m</span><span class="w"> </span><span class="s1">'hi &lt;string&gt;my&lt;/string&gt; &lt;error&gt;prompt&lt;/&gt;!'</span></code></pre>


<h4 id="content-can-contain-newlines">content can contain newlines</h4>

<pre class="highlight moonscript"><code><span class="n">expected</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">StyledText</span><span class="w"> </span><span class="s1">'x\nx'</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="w">
  </span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="s1">'string'</span><span class="p">,</span><span class="w"> </span><span class="mi">4</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="n">expected</span><span class="p">,</span><span class="w"> </span><span class="n">m</span><span class="w"> </span><span class="s2">"&lt;string&gt;x\nx&lt;/string&gt;"</span></code></pre>


<h4 id="handles-unicode-sequences-correctly">handles unicode sequences correctly</h4>

<pre class="highlight moonscript"><code><span class="n">run</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'ííí'</span><span class="w">
</span><span class="n">expected</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">StyledText</span><span class="w"> </span><span class="s2">"</span><span class="si">#{</span><span class="n">run</span><span class="si">}#{</span><span class="n">run</span><span class="si">}</span><span class="s2">Z"</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="w">
  </span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="s1">'x'</span><span class="p">,</span><span class="w"> </span><span class="o">#</span><span class="n">run</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">1</span><span class="w">
  </span><span class="o">#</span><span class="n">run</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="s1">'y'</span><span class="p">,</span><span class="w"> </span><span class="p">(</span><span class="o">#</span><span class="n">run</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="mi">2</span><span class="p">)</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">1</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="n">expected</span><span class="p">,</span><span class="w"> </span><span class="n">m</span><span class="w"> </span><span class="s2">"&lt;x&gt;</span><span class="si">#{</span><span class="n">run</span><span class="si">}</span><span class="s2">&lt;/x&gt;&lt;y&gt;</span><span class="si">#{</span><span class="n">run</span><span class="si">}</span><span class="s2">&lt;/&gt;Z"</span></code></pre>

</div>
